temp <- read.table(infile,sep=",",header = TRUE)

x_offset <- 0.03*max(temp$time)
#y_offset <- 0.02*max(temp[,2:length(temp)])
y_offset <- 0.02*max(temp[,2:4])

plot.new()
plot(temp[,1],temp[,2],type="l",xlab="Time",ylab="Populations",main="ESS Reaction Simulator v4.0")
#plot(temp[,1],temp[,2],type="l",xlab="Time",ylab="Populations",main="Simple ESS Model w/Triggers")

#for(i in 2:length(temp) ){
for(i in 2:4 ){
	lines(temp[,1],temp[,i],col=i)
	abline(mean(temp[,i]),0,col=i)
	temp_mean <- round(mean(temp[,i]),digits = 3)
	text(x_offset,temp_mean+y_offset,temp_mean,cex=0.8)
}


#legend("topleft",legend=paste(names(temp)[2:length(temp)]), fill = 
legend("topleft",legend=paste(names(temp)[2:4]), fill =
#2:length(names(temp)),bg=gray(1),cex=0.8)
2:4,bg=gray(1),cex=0.8)

#print(summary(temp[,2:length(names(temp))]))
print(summary(temp[,2:4]))

cat("\nTime = ",max(temp$time),"\n")
